Skip to content

Instantly share code, notes, and snippets.

@frozonfreak
frozonfreak / paperjs.html
Last active February 17, 2016 01:20
PaperJS with AngularJS
<!DOCTYPE html>
<html ng-app>
<head>
<meta charset="UTF-8">
<title>Lines</title>
<script type="text/javascript" src="js/vendor/paper.js"></script>
<script type="text/javascript" src="js/vendor/angular.min.js"></script>
</head>
<body ng-controller="PaperController">
$ cat /etc/clickhouse-server/conf.d/clusters.xml
<?xml version="1.0" ?>
<yandex>
<remote_servers>
<xxx>
<shard>
<replica> <host>h1</host> <port>9000</port></replica>
</shard>
....
</xxx>
@klipstein
klipstein / b64field.py
Created November 22, 2010 12:25
Base64 file handling for django-tastypie
import base64
import os
from tastypie.fields import FileField
from django.core.files.uploadedfile import SimpleUploadedFile
class Base64FileField(FileField):
"""
A django-tastypie field for handling file-uploads through raw post data.
It uses base64 for en-/decoding the contents of the file.
Usage:
@jaywilliams
jaywilliams / convert_ascii.php
Created May 28, 2009 19:25
This simple function will remove any non-ASCII character. Feel free to fork and extend!
<?php
/**
* Remove any non-ASCII characters and convert known non-ASCII characters
* to their ASCII equivalents, if possible.
*
* @param string $string
* @return string $string
* @author Jay Williams <myd3.com>
* @license MIT License
* @link http://gist.github.com/119517
@whoisryosuke
whoisryosuke / nextjs-hoc-authorization.js
Created June 26, 2018 22:24
ReactJS - NextJS - A HOC for wrapping NextJS pages in an authentication check. Checks for getInitialProps on the child component and runs it, so you still get SSR from the page. Also includes a user agent for Material UI.
import React, {Component} from 'react'
import Router from 'next/router'
import AuthService from './AuthService'
export default function withAuth(AuthComponent) {
const Auth = new AuthService('http://localhost')
return class Authenticated extends Component {
static async getInitialProps(ctx) {
// Ensures material-ui renders the correct css prefixes server-side
@ferdiunal
ferdiunal / array2json.php
Last active June 27, 2023 00:54
Ülkelerin İl, İlçeleri. Şimdilik Türkiye'yi ekleyebildim.
#!/usr/bin/env php
<?php
/**
* @author Ferdi ÜNAL
* @email ferdi@unal.pw
*/
$location = require "location.php";
$json = fopen('location.json', 'w');
@andelf
andelf / sendMail.go
Last active September 20, 2023 15:13
golang send mail net/smtp SMTP
package main
import (
"log"
"net/mail"
"encoding/base64"
"net/smtp"
"fmt"
"strings"
@jameshy
jameshy / papertrail-remove-all-systems.sh
Last active December 21, 2023 07:00
Remove all systems from papertrail
curl -s -H "X-Papertrail-Token: API-TOKEN-HERE" https://papertrailapp.com/api/v1/systems.json | jq '.[] .name' | xargs -I {} -d '\n' sh -c 'papertrail-remove-system -s {}; echo deleted {}'
@lleyton
lleyton / translation.md
Last active January 23, 2024 16:53
(ENG) Open Source Business Challenges and Reality, Rui Ueyama

Open Source Business Challenges and Reality

Original Japanese note here.

Original Author: Rui Ueyama (creator of the mold linker)

Translated by @windowsboy111

Minimally edited by @lleyton

@park-brian
park-brian / AdvancedWindowSnap.ahk
Last active February 6, 2024 21:53 — forked from AWMooreCO/AdvancedWindowSnap.ahk
Advanced Window Snap is a script for AutoHotKey that expands upon Windows built-in window-snapping hotkeys.
/**
* Advanced Window Snap
* Snaps the active window to a position within a user-defined grid.
*
* @author Andrew Moore <andrew+github@awmoore.com>
* @contributor jballi
* @contributor park-brian
* @contributor shinywong
* @version 1.2
*/