Skip to content

Instantly share code, notes, and snippets.

View bk138's full-sized avatar
🐿️
creating

Christian Beier bk138

🐿️
creating
View GitHub Profile
@EmielM
EmielM / uiwebview-tweaks.m
Created May 8, 2014 18:31
UIWebview enhancement hacks
// Continuously changing GIST of UIWebView 'tweaks' I use. Might be useful to others,
// hope Google finds this. Some of these already passed Review, but one never knows ;).
// Happy coding!
- (void)ScrollView_setContentOffset:(CGPoint)offset {
// Prevent superfluous scrolling animations (eg when toggling keyboard) by completely disabling scrolling. We achieve scrolling through inner scroll views (overflowing html elements).
}
- (id)WebBrowserView_inputAccessoryView {
// Make the keyboard accessory view (next/prev,submit buttons) optional, it really takes up to much screen estate in a normal app.
@jokecamp
jokecamp / package.json
Last active July 6, 2020 13:50
Demo for Passport.js authentication in a Node.js Express application
{
"name": "securehelloworld",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
@andrewharvey
andrewharvey / logrotatecat
Created December 15, 2011 09:34
cat's a bunch of log rotate log files in correct order
#!/bin/bash
# using,
#
# ./logrotatecat access.log
#
# inside a directory of log rotate logs in a form like
#
# access.log
# access.log.1
@baines
baines / xkeyexample.c
Last active September 19, 2023 20:53
simple xlib key example
#include <stdio.h>
#include <locale.h>
#include <X11/Xlib.h>
#include <X11/keysym.h>
int main(void){
setlocale(LC_ALL, "");
Display* dpy = XOpenDisplay(NULL);
@cjus
cjus / jsonval.sh
Created June 26, 2011 17:42
Extract a JSON value from a BASH script
#!/bin/bash
function jsonval {
temp=`echo $json | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w $prop`
echo ${temp##*|}
}
json=`curl -s -X GET http://twitter.com/users/show/$1.json`
prop='profile_image_url'
picurl=`jsonval`
@pulsar256
pulsar256 / opus-p2p-streaming.md
Last active January 29, 2024 01:19
Opus p2p Audio Streaming

Opus p2p streaming

Low latency streaming of ogg compressed audio data between two peers using RTP and gstreamer-1.0. Expected latency over the network is below 1 second.

Producer

The producer will provide a Jack sink which needs to be connected to a audio producer.

TARGET_PORT=5100
@MightyPork
MightyPork / utf8_encode.c
Last active February 28, 2024 08:07
C function to encode a Unicode code point as UTF-8 byte array
#include <stdint.h>
/**
* Encode a code point using UTF-8
*
* @author Ondřej Hruška <ondra@ondrovo.com>
* @license MIT
*
* @param out - output buffer (min 5 characters), will be 0-terminated
* @param utf - code point 0-0x10FFFF
@steipete
steipete / PSPDFEnvironment.m
Last active March 5, 2024 09:15
Example for DISPATCH_SOURCE_TYPE_MEMORYPRESSURE (Mac only, since 10.9) ... Since we share code between iOS and mac, I'm trying to be a good system citizen and reimplement the equivalent of UIApplicationDidReceiveMemoryWarningNotification on the Mac.
NSString *const PSPDFApplicationDidReceiveMemoryWarningNotification = @"PSPDFApplicationDidReceiveMemoryWarningNotification";
// Test with sudo memory_pressure -l critical. Don't forget to re-set afterwards!
__attribute__((constructor)) static void PSPDFInstallLowMemoryNotificationWarningMac(void) {
static dispatch_source_t source;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
source = dispatch_source_create(DISPATCH_SOURCE_TYPE_MEMORYPRESSURE, 0, DISPATCH_MEMORYPRESSURE_WARN|DISPATCH_MEMORYPRESSURE_CRITICAL, dispatch_get_main_queue());
dispatch_source_set_event_handler(source, ^{
dispatch_source_memorypressure_flags_t pressureLevel = dispatch_source_get_data(source);
@Farhan-Haseeb
Farhan-Haseeb / README
Created June 17, 2020 16:51
How to reopen a closed PR on Github
How to reopen a pull-request from github?
Precodinitions
You need the rights to reopen pull requests on the repository.
The pull request hasn't been merged, just closed.
Go to Pull requests add filter `is:closed` choose PR you want to reopen. Select from checkbox and mark as Open.
@samiraguiar
samiraguiar / MC Cheat Sheet
Last active April 13, 2024 10:22 — forked from maciakl/MC Cheat Sheet
Midnight Commander Cheat Sheet / Shortcuts
Note for newcomers:
In the shortcuts below, "C" stands for CTRL and "A" stands for "ALT". This is a convention
used in the Midnight Commander documentation and was kept here.
You can also use "ESC" instead of "ALT", which is useful on Macbooks.
Main View
---------------------------------------------------------------
- File/directory operations