This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| zngguvnf's Blog | |
| Processing multiple PDFs using the command line | |
| :linux: | |
| <2017-12-01> | |
| Update [2018-04-17 Tue] | |
| Remove password from pdf | |
| Remove string from pdf | |
| Update [2018-03-30 Fri]: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <Indexer> | |
| <coverages> | |
| <coverage> | |
| <schema name="Temperature_surface"> | |
| <attributes>the_geom:Polygon,location:String,imageindex:Integer,time:java.util.Date</attributes> | |
| </schema> | |
| <origName>Temperature_surface</origName> | |
| <name>Temperature_surface</name> | |
| </coverage> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Ubuntu Server or VM Cleaner. Safe by default; aggressive when asked. | |
| # Example safe: sudo ./clean.sh | |
| # Example aggressive: sudo JOURNAL_DAYS=3 AGGRESSIVE=1 ./clean.sh | |
| # Enable Docker image prune (images only): sudo ./clean.sh --docker-images | |
| # Tested on Ubuntu 20.04, 22.04, 24.04 (server/VM images). | |
| set -Eeuo pipefail | |
| trap 'rc=$?; echo "Error on line $LINENO: $BASH_COMMAND (exit $rc)"; exit $rc' ERR | |
| IFS=$'\n\t' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Data.Entity; | |
| using System.Data.Entity.ModelConfiguration.Conventions; | |
| using System.Data.SQLite; | |
| using System.Linq; | |
| namespace SQliteEF6 | |
| { | |
| class SqliteContext : DbContext |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ############################################################################### | |
| # Helpful Docker commands and code snippets | |
| ############################################################################### | |
| ### CONTAINERS ### | |
| docker stop $(docker ps -a -q) #stop ALL containers | |
| docker rm -f $(docker ps -a -q) # remove ALL containers | |
| docker rm -f $(sudo docker ps --before="container_id_here" -q) # can also filter | |
| # exec into container |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Bulk convert shapefiles to geojson using ogr2ogr | |
| # For more information, see http://ben.balter.com/2013/06/26/how-to-convert-shapefiles-to-geojson-for-use-on-github/ | |
| # Note: Assumes you're in a folder with one or more zip files containing shape files | |
| # and Outputs as geojson with the crs:84 SRS (for use on GitHub or elsewhere) | |
| #geojson conversion | |
| function shp2geojson() { | |
| ogr2ogr -f GeoJSON -t_srs crs:84 "$1.geojson" "$1.shp" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Web.Mvc; | |
| namespace DemoApp.Areas.Demo | |
| { | |
| public class DemoAreaRegistration : AreaRegistration | |
| { | |
| public override string AreaName | |
| { | |
| get | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [RoutePrefix("files")] | |
| public class FilesController : ApiController | |
| { | |
| [GET("somepdf/{id}")] | |
| public HttpResponseMessage GetSomePdf(string id) | |
| { | |
| var path = MyApp.PathToSomePdf(id); | |
| if (path!= null) | |
| return FileAsAttachment(path, "somepdf.pdf"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Calculates the checksum for a sentence | |
| // Calculates the checksum for a sentence | |
| static string getChecksum(string sentence) { | |
| //Start with first Item | |
| int checksum= Convert.ToByte(sentence[sentence.IndexOf('$')+1]); | |
| // Loop through all chars to get a checksum | |
| for (int i=sentence.IndexOf('$')+2 ; i<sentence.IndexOf('*') ; i++){ | |
| // No. XOR the checksum with this character's value | |
| checksum^=Convert.ToByte(sentence[i]); |