Skip to content

Instantly share code, notes, and snippets.

View dyashkir's full-sized avatar
🏃

Dmytro Yashkir dyashkir

🏃
View GitHub Profile
@scottopell
scottopell / fix_exfat_drive.md
Last active April 30, 2024 22:46
Fix corrupted exFAT disk macOS/OSX

exFAT support on macOS seems to have some bugs because my external drives with exFAT formatting will randomly get corrupted.

Disk Utility is unable to repair this at first, but the fix is this:

  1. Use diskutil list to find the right drive id.
  2. You want the id under the IDENTIFIER column, it should look like disk1s1
  3. Run sudo fsck_exfat -d <id from above>. eg sudo fsck_exfat -d disk1s3
  4. -d is debug so you'll see all your files output as they're processed.
  5. Answer YES if it gives you the prompt Main boot region needs to be updated. Yes/No?
@chengyin
chengyin / linkedout.js
Last active July 11, 2021 15:23
Unsubscribe all LinkedIn email in "one click". For an easier to use version, you can check out the bookmarklet: http://chengyin.github.io/linkedin-unsubscribed/
// 1. Go to page https://www.linkedin.com/settings/email-frequency
// 2. You may need to login
// 3. Open JS console
// ([How to?](http://webmasters.stackexchange.com/questions/8525/how-to-open-the-javascript-console-in-different-browsers))
// 4. Copy the following code in and execute
// 5. No more emails
//
// Bookmarklet version:
// http://chengyin.github.io/linkedin-unsubscribed/
@widoyo
widoyo / kas.py
Created October 16, 2012 07:42
Generating PDF using Flask & ReportLab
from flask import make_response
from reportlab.pdfgen import canvas
# ...
@app.route('/pdf')
def pdf():
import cStringIO
output = cStringIO.StringIO()
@bendangelo
bendangelo / PaperclipStringFile
Created May 23, 2012 15:47
Paperclip string to file
module Paperclip
#converts a string into a file for paperclip to save
# useage
# self.avatar = Paperclip::string_to_file('bob.png', 'image/png', 'BASE64 here')
def self.string_to_file(name, type, data)
image = StringIO.new(data)
image.class.class_eval { attr_accessor :original_filename, :content_type }
image.original_filename = name
image.content_type = type
@santosh79
santosh79 / twitter-oauth.js
Created March 3, 2012 07:04
Twitter OAuth with node-oauth for node.js+express
var express = require('express');
var sys = require('util');
var oauth = require('oauth');
var app = express.createServer();
var _twitterConsumerKey = process.env['TWITTER_CONSUMER_KEY'];
var _twitterConsumerSecret = process.env['TWITTER_CONSUMER_SECRET'];
console.log("_twitterConsumerKey: %s and _twitterConsumerSecret %s", process.env['TWITTER_CONSUMER_KEY'], process.env['TWITTER_CONSUMER_SECRET']);
@tbeseda
tbeseda / basic_auth_app.coffee
Created December 29, 2011 21:19
Basic HTTP Auth with Express for Node.js
express = require 'express'
app = express.createServer()
auth = express.basicAuth 'yourmom', 'p4ssw0rd'
app.get '/', auth, (req, res) ->
res.send your_super_secret_stuff
app.listen 3000, ->
console.log "Listening on #{port}"
@scottmessinger
scottmessinger / backbone-todos.js
Created June 19, 2011 00:09
Backbone.js todos vs knockout.js todos
We couldn’t find that file to show.
# These are my notes from the PragProg book on CoffeeScript of things that either
# aren't in the main CS language reference or I didn't pick them up there. I wrote
# them down before I forgot, and put it here for others but mainly as a reference for
# myself.
# assign arguments in constructor to properties of the same name:
class Thingie
constructor: (@name, @url) ->
# is the same as:
@cnruby
cnruby / install ncurses on macosx
Created May 7, 2011 09:05
HOW TO INSTALL ncurses on MacOSX
$ curl -O ftp://ftp.gnu.org/gnu/ncurses/ncurses-5.9.tar.gz
$ tar -xzvf ncurses-5.9.tar.gz
$ cd ./ncurses-5.9
$ ./configure --prefix=/usr/local \
--without-cxx --without-cxx-binding --without-ada --without-progs --without-curses-h \
--with-shared --without-debug \
--enable-widec --enable-const --enable-ext-colors --enable-sigwinch --enable-wgetch-events \
&& make
$ sudo make install
// BlackBerry Geolocation. Tested w/ 4.6.0.297.
// http://docs.blackberry.com/en/developers/deliverables/1143/browser_devguide.pdf
if (window.blackberry && blackberry.location && blackberry.location.GPSSupported) {
var AUTONOMOUS_AID_MODE = 2;
function win() {
clearTimeout(failTimeoutId);
blackberry.location.removeLocationUpdate(win);
alert(blackberry.location.latitude + " : " + blackberry.location.longitude);
}