Skip to content

Instantly share code, notes, and snippets.

View garenyondem's full-sized avatar
:shipit:

Garen Yöndem garenyondem

:shipit:
  • Afiniti
  • 19:28 (UTC +03:00)
View GitHub Profile
using Microsoft.Phone.Controls;
using System;
using System.Windows.Controls.Primitives;
/// <summary>
/// This class detects the pull gesture on a LongListSelector. How does it work?
///
/// This class listens to the change of manipulation state of the LLS, to the MouseMove event
/// (in WP, this event is triggered when the user moves the finger through the screen)
/// and to the ItemRealized/Unrealized events.
@ericsaboia
ericsaboia / uncaughtException.js
Created May 19, 2014 15:11
Sending emails on uncaughtException
if (config.admin.email) {
process.on('uncaughtException', function(err) {
console.log(err.stack);
nodemailer.createTransport("SMTP", {
service: "Sendgrid"
, auth: {
user: config.smtp.username
, pass: config.smtp.password
}
}).sendMail({
@longzheng
longzheng / gist:2308859
Last active December 8, 2017 05:09
Windows 8.1 default XAML templates and styles
<!--
//
// Copyright (c) Microsoft Corporation. All Rights Reserved.
//
-->
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.ThemeDictionaries>
@niqdev
niqdev / rename-branch-github.txt
Last active January 15, 2020 18:17
Rename local and remote branch on GitHub
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@mdwheele
mdwheele / yosemite-sound-issues.md
Created October 22, 2014 00:25
Fix Yosemite Bluetooth Sound Issues
  1. Run the following in your terminal.
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Max (editable)" 80
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" 80
defaults write com.apple.BluetoothAudioAgent "Apple Initial Bitpool (editable)" 80
defaults write com.apple.BluetoothAudioAgent "Apple Initial Bitpool Min (editable)" 80
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool" 80
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool Max" 80
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool Min" 80
@stilist
stilist / monitoring.md
Last active October 27, 2020 05:36
Notes on site reliability

Monitoring

Alerting

  • base rate fallacy: given 1% false positive, 1% false negative, and 99.9% uptime: 9.1% chance positive predictive value (true positive)
  • sensitivity (% true positives) vs specificity (% not false positive)
  • ‘Alert liberally; page judiciously. Page on symptoms, rather than causes.’
  • ‘An alert should communicate something specific about your systems in plain language: “Two Cassandra nodes are down” or “90% of all web requests are taking more than 0.5s to process and respond.”’
  • ‘Not all alerts carry the same degree of urgency.’
  • ‘Many alerts will not be associated with a service problem, so a human may never even need to be aware of them. […] should generate a low-urgency alert that is recorded in your monitoring system for future reference or investigation but does not interrupt anyone’s work.’
const crypto = require('crypto');
const fs = require('fs');
const path = require('path');
const zlib = require('zlib');
const getCipherKey = require('./getCipherKey');
function decrypt({ file, password }) {
// First, get the initialization vector from the file.
const readInitVect = fs.createReadStream(file, { end: 15 });
const crypto = require('crypto');
const fs = require('fs');
const path = require('path');
const zlib = require('zlib');
const AppendInitVect = require('./appendInitVect');
const getCipherKey = require('./getCipherKey');
function encrypt({ file, password }) {
// Generate a secure, pseudo random initialization vector.
@ahacke
ahacke / github_ssh_keepass.md
Last active March 13, 2023 07:05
Guide on how to setup github ssh keys with keepass

Github SSH with KeePass

Requirements

  • Git
  • Github Account
  • KeePass with KeeAgent
  • Putty Package
    • plink
    • puttygen
@kennydude
kennydude / Java.java
Created July 14, 2012 14:31
Encrypt from Java and decrypt on Node.js
// Encrypt where jo is input, and query is output and ENCRPYTION_KEy is key
byte[] input = jo.toString().getBytes("utf-8");
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] thedigest = md.digest(ENCRYPTION_KEY.getBytes("UTF-8"));
SecretKeySpec skc = new SecretKeySpec(thedigest, "AES/ECB/PKCS5Padding");
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, skc);
byte[] cipherText = new byte[cipher.getOutputSize(input.length)];