This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {ipcMain} from 'electron' | |
| const fs = require('fs') | |
| const axios = require('axios') | |
| /* ... */ | |
| ipcMain.on('downloadFile', function (event, data) { | |
| const filePath = data.filePath | |
| const item = data.item |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <head> | |
| <script> | |
| var recordedChunks = []; | |
| var constraints = { | |
| audio: true, | |
| video: true | |
| }; | |
| var mediaRecorder = null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule Game do | |
| use GenServer | |
| def init(game_id) do | |
| {:ok, %{game_id: game_id}} | |
| end | |
| def start_link(game_id) do | |
| GenServer.start_link(__MODULE__, game_id, name: {:global, "game:#{game_id}"}) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Customize website's scrollbar like Mac OS | |
| Not supports in Firefox and IE */ | |
| /* total width */ | |
| body::-webkit-scrollbar { | |
| background-color: #fff; | |
| width: 16px; | |
| } | |
| /* background of the scrollbar except button or resizer */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule Default.Behaviour do | |
| @moduledoc """ | |
| Creates a behaviour that carries its own default implementation. | |
| When used into a behaviour module, when that module in turn is used, all functions | |
| defined on it are given to the using module. | |
| This allows you to have concrete implementations of the behaviour's default functionality | |
| for testing, unlike cramming them all into a __using__ macro. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var canvas = document.createElement('canvas'); | |
| var gl; | |
| var debugInfo; | |
| var vendor; | |
| var renderer; | |
| try { | |
| gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl'); | |
| } catch (e) { | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Adapted from these sources: | |
| -- http://peterdowns.com/posts/open-iterm-finder-service.html | |
| -- https://gist.github.com/cowboy/905546 | |
| -- | |
| -- Modified to work with files as well, cd-ing to their container folder | |
| on run {input, parameters} | |
| tell application "Finder" | |
| set my_file to first item of input | |
| set is_folder to (do shell script "file -b " & quoted form of (POSIX path of my_file)) | |
| if is_folder ends with "directory" then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| if [ -z "$1" ] | |
| then echo " | |
| File name to process required. File name shouldn't contain any whitespace chars. | |
| If you want to limit cpu use for example: | |
| cpulimit -e ffmpeg -l 200 # every thread has 100 'points' | |
| " | |
| else | |
| # This line is used for testing small chunks of the file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule Benchmarks do | |
| def init do | |
| :ok = :lbm_kv.create(Web.Job) | |
| end | |
| def count_entries do | |
| IO.puts "Web.Job => #{:lbm_kv.match_key(Web.Job, :_) |> elem(1) |> Enum.count}" | |
| end | |
| def measure_throughput(fun, num_items) do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Add the following line at the top of your .ovpnfile to prevent it from routing all network traffic on your Mac through | |
| the VPN: | |
| route-nopull | |
| Next add the following line to allow the VPN to reroute traffic ONLY for a given IP address / domain (if you need to enable it | |
| for a domain you can use its IP address): | |
| route 1.2.3.4 |