Skip to content

Instantly share code, notes, and snippets.

View umrysh's full-sized avatar
🏠
Working from home

Dave Umrysh umrysh

🏠
Working from home
View GitHub Profile
@mikehouse
mikehouse / GCDWebServer+CORS.m
Created October 2, 2019 15:45
GCDWebServer make Cross-Origin Resource Sharing (WKWebView as example)
GCDWebServer *_webServer = [[GCDWebServer alloc] init];
[_webServer addDefaultHandlerForMethod:@"GET"
requestClass:[GCDWebServerRequest class]
processBlock:^GCDWebServerResponse *(GCDWebServerRequest* request) {
GCDWebServerDataResponse *response = [GCDWebServerDataResponse responseWithHTML:@"true"];
[response setValue:@"*" forAdditionalHeader:@"Access-Control-Allow-Origin"];
[response setValue:@"X-Requested-With, Content-Type" forAdditionalHeader:@"Access-Control-Allow-Headers"];
[response setValue:@"GET, POST, OPTIONS" forAdditionalHeader:@"Access-Control-Allow-Methods"];
@namnm
namnm / mining-pool-comparison.md
Created October 10, 2017 09:36
Mining pool comparison
@mirhec
mirhec / raspi-setup-gitea.md
Created September 20, 2017 07:14
Installing Gitea on Raspberry Pi with nginx, SSL and automatic backups

Setup Gitea on Raspberry Pi (3)

These instructions are based on this article: https://www.alexruf.net/2016/05/23/setup-gogs-git-service.html.

Setup Raspberry Pi with minimal Raspbian image. You need to connect to the HDMI port and set the following:

sudo raspi-config

There you need to enable the SSH server and you should change the hostname.

@flawyte
flawyte / Device.java
Last active April 7, 2024 15:28
How to get an Android device's serial number, visible to the user in "Settings > About phone/tablet/device > Status > Serial number".
import android.os.Build;
import java.lang.reflect.Method;
public class Device {
/**
* @return The device's serial number, visible to the user in {@code Settings > About phone/tablet/device > Status
* > Serial number}, or {@code null} if the serial number couldn't be found
*/
public static String getSerialNumber() {
@gregsgit
gregsgit / CodeCommitLambdaFunction_allEvents.py
Last active December 4, 2021 05:45
AWS Lambda triggered by pushes/commits, constructs simple message and then triggers a SNS topic
# ARN - arn:aws:lambda:us-east-2:750303481583:function:DoverCodeCommitLambdaFunction_allEvents
import json
import boto3
from datetime import datetime as dt
from string import split
codecommit = boto3.client('codecommit')
sns = boto3.client('sns')
@arthurleon
arthurleon / unique-val-col-calc
Created June 25, 2015 14:44
Get unique values of a column in Libre Office Calc
Select the whole column
Data > Filter > Standard Filter
Change 'Field Name' to -none- , click on 'More options' and check on 'No duplication' box
Source: http://superuser.com/questions/238656/openoffice-get-distinct-values-from-column
@bMinaise
bMinaise / multipage-navigation.php
Created November 11, 2013 17:57
Gravity Forms - Multi page navigation
/**
* Multi-page Navigation
* http://gravitywiz.com/
**/
class GWMultipageNavigation {
private $script_displayed;
function __construct( $args = array() ) {
@prof7bit
prof7bit / _stoploss.py
Created April 22, 2013 18:01
A simple stop loss bot. Adjust STOP_PRICE and STOP_VOLUME to your needs. The file can be reloaded after editing without restarting goxtool by simply pressing the l key.
"""
a simple stop loss bot.
adjust STOP_PRICE and STOP_VOLUME to your needs.
The file can be reloaded after editing without
restarting goxtool by simply pressing the l key.
"""
import strategy
import goxapi
# pylint: disable=C0301
@spivurno
spivurno / gw-multi-page-navigation.php
Last active February 4, 2022 09:48
Gravity Wiz // Gravity Forms // Multi-page Form Navigation
<?php
/**
* Gravity Wiz // Gravity Forms // Multi-page Navigation
*
* Adds support for navigating between form pages by converting the page steps into page links or creating your own custom page links.
*
* @version 2.1
* @author David Smith <david@gravitywiz.com>
* @license GPL-2.0+
* @link http://gravitywiz.com/multi-page-navigation/
@scvalex
scvalex / pull_contacts.py
Created July 15, 2010 23:25
Pull data from Google Contacts
#!/usr/bin/python
"""Module for pulling contacts out of Google and storing them to disk
(or something).
See the official guide for a more in-depth look at GData Python
http://code.google.com/apis/contacts/docs/1.0/developers_guide_python.html
"""
import atom