Skip to content

Instantly share code, notes, and snippets.

View akofman's full-sized avatar
⚙️
Remote Deep Learner

Alexis Kofman akofman

⚙️
Remote Deep Learner
View GitHub Profile
@akofman
akofman / postgres-cheatsheet.md
Created May 18, 2022 00:56 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to make opened Markdown files always be soft wrapped:
#
# path = require 'path'
#
  • Run an interractive shell (ctrl+P ctrl+q to detach):
    docker run -i -t <imageName> /bin/bash

  • Update an image:
    docker commit <containerId> <imageName>

  • Save an image to a tar archive:
    docker save <imageName> > <image.tar>

  • Load an image from a tar archive:

@akofman
akofman / MD5.swift
Last active April 3, 2018 10:42
Swift helper to convert a string or a file to a md5sum
class MD5{
static func stringSum(string: String) -> String {
var digest = [UInt8](count: Int(CC_MD5_DIGEST_LENGTH), repeatedValue: 0)
if let data = string.dataUsingEncoding(NSUTF8StringEncoding) {
CC_MD5(data.bytes, CC_LONG(data.length), &digest)
}
var digestHex = ""
for index in 0..<Int(CC_MD5_DIGEST_LENGTH) {
@akofman
akofman / add-swift-support.js
Last active May 9, 2017 08:46
Cordova plugin hook to add swift support
/*
* This hook adds all the needed config to implement a Cordova plugin with Swift.
*
* - It adds a Bridging header importing Cordova/CDV.h if it's not already
* the case. Else it concats all the bridging headers in one single file.
*
* /!\ Please be sure not naming your bridging header file 'Bridging-Header.h'
* else it won't be supported.
*
* - It puts the ios deployment target to 7.0 in case your project would have a
@akofman
akofman / remove-files.js
Last active February 9, 2016 10:03
Cordova hook to remove files in a plugin bundle after installing it
#!/usr/bin/env node
/*
* Hook removing files you do not want to keep in your plugin bundle.
* These files have to be configured from the "filesToRemove" attribute of
* the package.json file of your plugin.
*
* Here is an example where demo is a folder and foo.txt a file :
* filesToRemove : ["demo", "foo.txt"]
*/
tell application "Transmit"
set myFave to item 1 of (favorites whose name is "s3.amazonaws.com")
tell current tab of (make new document at end)
connect to myFave with mount
close
end tell
end tell
tell application “Transmit” to quit
@akofman
akofman / imagemagick.md
Last active November 16, 2015 16:06
imagemagick cmds

Reduce quality for a set of images

mogrify -quality 50 *.jpg
@akofman
akofman / disable-bitcode.js
Last active July 5, 2016 19:57
Cordova hook to disable bitcode for ios9 projects.
#!/usr/bin/env node
/*
* Disable bitcode for ios9 projects.
* versions:
* xcode 0.8.2
* cordova-lib 5.3.3
*/
var xcode = require('xcode');
@akofman
akofman / checkIosProvisiongProfile.md
Last active July 28, 2022 14:34
Check devices in a provisioning profile

After exporting an ipa for Ad Hoc Deployment, it could be useful to check if all authorized devices are well configured in a provisioning profile. To read a provisioning profile you have to unarchive your ipa :

$ unzip your.ipa

find the embedded.mobileprovision file :

$ ls yourUnzippedIpa/Payload/appName.app/embedded.mobileprovision