Skip to content

Instantly share code, notes, and snippets.

@ciel
ciel / xmlToJson.js
Created June 5, 2019 16:37 — forked from chinchang/xmlToJson.js
Function to convert XML to JSON
// Changes XML to JSON
// Modified version from here: http://davidwalsh.name/convert-xml-json
function xmlToJson(xml) {
// Create the return object
var obj = {};
if (xml.nodeType == 1) { // element
// do attributes
if (xml.attributes.length > 0) {
@ciel
ciel / playsong.py
Created February 17, 2019 13:20 — forked from ThomasGaubert/playsong.py
Play songs from Google Play Music in VLC.
from gmusicapi import Webclient
from gmusicapi import Mobileclient
import vlc
import urllib
# Use Google account credintials. If two factor is enabled, use application specific password.
email = '[email protected]'
password = 'password'
# Device ID for API queries. Leave blank if unknown.
@ciel
ciel / clean-node-modules.sh
Created October 2, 2018 01:11 — forked from cusspvz/clean-node-modules.sh
Delete all node_modules folders RECURSIVELY
#!/bin/bash
# this will find all node_modules above your path and will remove them
find . | grep /node_modules$ | grep -v /node_modules/ | xargs rm -fR
@ciel
ciel / gist:4aeaf0a4bd4ad590f1859c10f0b37344
Created September 22, 2018 12:35 — forked from Filipemnzs/gist:a4593156188ca4b5e3811ddc3306335f
Basic discord bot with multiple commands C#
using Discord;
using Discord.Commands;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ciel
ciel / gist:5a706e823c82b92c678d481edaf38761
Created September 22, 2018 12:35 — forked from Filipemnzs/gist:a4593156188ca4b5e3811ddc3306335f
Basic discord bot with multiple commands C#
using Discord;
using Discord.Commands;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ciel
ciel / app.js
Created April 30, 2018 01:18
Simple, complete example of a bot in Discord.js
// Load up the discord.js library
const Discord = require("discord.js");
// This is your client. Some people call it `bot`, some people call it `self`,
// some might call it `cootchie`. Either way, when you see `client.something`, or `bot.something`,
// this is what we're refering to. Your client.
const client = new Discord.Client();
// Here we load the config.json file that contains our token and our prefix values.
const config = require("./config.json");
@ciel
ciel / jsonPuller
Created April 6, 2018 02:50 — forked from crstamps2/jsonPuller
A Google apps script to pull json from a spreadsheet
function doGet(){
var ss = SpreadsheetApp.openById("//key ommitted");
return exportJSON(ss);
}
// Exports current sheet as JSON and displays in message box.
function exportJSON(ss) {
var sheet = ss.getSheetByName("sessions");
var rowsData = getRowsData(sheet);
@ciel
ciel / gist:158d1420c7854c57e3faad9fd99b2363
Created April 6, 2018 02:30 — forked from daaain/gist:3932602
Google App Script - Spreadsheet JSON export
/**
* Adds a custom menu to the active spreadsheet, containing a single menu item
* for invoking the exportJSON() function specified above.
* The onOpen() function, when defined, is automatically invoked whenever the
* spreadsheet is opened.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function onOpen() {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
@ciel
ciel / open-w-atom.reg
Created January 16, 2018 08:18 — forked from kyle-ilantzis/open-w-atom.reg
Adds 'Open in Atom' to context menu in Windows Explorer.
Windows Registry Editor Version 5.00
;
; Adds 'Open in Atom' to context menu (when you right click) in Windows Explorer.
;
; Based on https://github.com/Zren/atom-windows-context-menu. It didn't work
; https://github.com/Zren/atom-windows-context-menu/issues/1.
;
; Save this file to disk with a .reg extension. Replace C:\\Atom\\atom.exe with
; the path to the atom executable on your machine.
@ciel
ciel / convert_array_to_dictionary.ts
Created December 30, 2017 05:18 — forked from ArtemAvramenko/convert_array_to_dictionary.ts
TypeScript convert array to dictionary
static toDictionary<TItem>(
array: TItem[],
getKey: (item: TItem) => number): { [id: number]: TItem };
static toDictionary<TItem, TValue>(
array: TItem[],
getKey: (item: TItem) => number,
getValue: (item: TItem) => TValue): { [id: number]: TValue };
static toDictionary<TItem>(
array: TItem[],
getKey: (item: TItem) => string): { [id: string]: TItem };