Skip to content

Instantly share code, notes, and snippets.

View glaszig's full-sized avatar

glaszig

  • available for hire. contact me.
  • remote
View GitHub Profile
@mesuutt
mesuutt / chart.html
Last active March 23, 2021 02:08
Chart.js - Doughnut chart with custom legend http://codepen.io/mesuutt/pen/LbyPvr
<div class="canvas-con">
<div class="canvas-con-inner">
<canvas id="mychart" height="250px"></canvas>
</div>
<div id="my-legend-con" class="legend-con"></div>
</div>
@PaulChana
PaulChana / NSTaskAsyncOutput.mm
Created October 17, 2016 09:12
NSTask Async output to NSTaskView
NSMutableArray *arguments = [[NSMutableArray alloc] init];
[arguments addObject:[[NSBundle mainBundle] pathForResource:@"MyScript" ofType:@"py"]];
[arguments addObject:@"--verbose"]; // Any arguments you want here...
NSTask* task = [[NSTask alloc] init];
task.launchPath = @"/usr/bin/python";
task.arguments = arguments;
NSMutableDictionary *defaultEnv = [[NSMutableDictionary alloc] initWithDictionary:[[NSProcessInfo processInfo] environment]];
[defaultEnv setObject:@"YES" forKey:@"NSUnbufferedIO"] ;
@seckincengiz
seckincengiz / ExampleUsage.swift
Last active July 10, 2018 19:21 — forked from s-aska/Keychain.swift
Swift Keychain class ( supported Xcode 8.1 Beta and IOS 10.1 ) [swift3]
import UIKit
let scoresStringArray : [String] = ["Mike","Tom","Bily"]
let scoresDataArray = NSKeyedArchiver.archivedData(withRootObject: scoresStringArray)
//Save data
_ = Keychain.save(key: "scoresKey", data: scores)
//Load data
if Keychain.load(key: "scoresKey") != nil{
@mminer
mminer / PreferencesViewController.swift
Last active May 19, 2024 05:06
NSTabViewController for preferences window that resizes itself to fit activated tab view.
import AppKit
class PreferencesViewController: NSTabViewController {
private lazy var tabViewSizes: [NSTabViewItem: NSSize] = [:]
override func tabView(_ tabView: NSTabView, didSelect tabViewItem: NSTabViewItem?) {
super.tabView(tabView, didSelect: tabViewItem)
if let tabViewItem = tabViewItem {
@yefim
yefim / Dockerrun.aws.json
Last active April 7, 2023 16:11
Build a Docker image, push it to AWS EC2 Container Registry, then deploy it to AWS Elastic Beanstalk
{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "<AWS_ACCOUNT_ID>.dkr.ecr.us-east-1.amazonaws.com/<NAME>:<TAG>",
"Update": "true"
},
"Ports": [
{
"ContainerPort": "443"
}
@aleclaws
aleclaws / seckeyrefnsdata.c
Last active September 1, 2021 05:32
SecKeyRef to NSData
// HELPER QUERIES
void queryValueToData(NSMutableDictionary *query, void * value) {
query[(__bridge id)kSecValueRef] = (__bridge id)value ;
query[(__bridge id)kSecReturnData] = @YES ;
}
void queryDataToValue(NSMutableDictionary *query, id data) {
@jult
jult / blockpeers.sh
Last active December 28, 2024 13:59
blocking p2p peer snoopers and evil corp (for Tixati IP filter and such)
#!/bin/sh
# This script runs every other night at 04:56 CET on a webserver I maintain
# Results are always at: https://jult.net/block.txt ( or https://jult.net/block.txt.gz )
# And much smaller, stripped of BS; https://jult.net/bloc.txt
# For use in Tixati IP filter: https://jult.net/bloc.txt.gz !!!
# And finally a txt file with just the bold IP-ranges: https://jult.net/bl.txt (or https://jult.net/bl.txt.gz )
# Download open block-lists, unpack, filter:
curl -s https://www.iblocklist.com/lists.php | grep -A 2 Bluetack | xargs wget -qO - --limit-rate=500k | gunzip -f | egrep -v '^#' > /tmp/xbp
@zynick
zynick / download-file.js
Created January 6, 2016 12:17
download file ('save as') using javascript xhr
// http://stackoverflow.com/a/23797348/1150427
xhr.open('POST', url, true);
xhr.responseType = 'arraybuffer';
xhr.onload = function () {
if (this.status === 200) {
var filename = "";
var disposition = xhr.getResponseHeader('Content-Disposition');
if (disposition && disposition.indexOf('attachment') !== -1) {
var filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
@superjamie
superjamie / raspberry-pi-vpn-router.md
Last active December 29, 2024 07:04
Raspberry Pi VPN Router

Raspberry Pi VPN Router

This is a quick-and-dirty guide to setting up a Raspberry Pi as a "router on a stick" to PrivateInternetAccess VPN.

Requirements

Install Raspbian Jessie (2016-05-27-raspbian-jessie.img) to your Pi's sdcard.

Use the Raspberry Pi Configuration tool or sudo raspi-config to:

@kamilkisiela
kamilkisiela / codeship.sh
Last active March 6, 2016 19:21
Codeship - Symfony2 with mysql - phpunit
# Set php version through phpenv
phpenv local 5.5
# Modify memory limit and realpath cache size
echo "realpath_cache_size = 4096k" >> $HOME/.phpenv/versions/5.5/etc/php.ini
echo "memory_limit = 512M" >> $HOME/.phpenv/versions/5.5/etc/php.ini
# Disable xdebug
echo "xdebug.remote_autostart=0" >> $HOME/.phpenv/versions/5.5/etc/php.ini
echo "xdebug.remote_enable=0" >> $HOME/.phpenv/versions/5.5/etc/php.ini