Skip to content

Instantly share code, notes, and snippets.

View doesdev's full-sized avatar
💻
prolly just making codes

Andrew Carpenter doesdev

💻
prolly just making codes
View GitHub Profile
@pcgeek86
pcgeek86 / cheatsheet.ps1
Last active July 12, 2024 19:13
PowerShell Cheat Sheet / Quick Reference
Get-Command # Retrieves a list of all the commands available to PowerShell
# (native binaries in $env:PATH + cmdlets / functions from PowerShell modules)
Get-Command -Module Microsoft* # Retrieves a list of all the PowerShell commands exported from modules named Microsoft*
Get-Command -Name *item # Retrieves a list of all commands (native binaries + PowerShell commands) ending in "item"
Get-Help # Get all help topics
Get-Help -Name about_Variables # Get help for a specific about_* topic (aka. man page)
Get-Help -Name Get-Command # Get help for a specific PowerShell function
Get-Help -Name Get-Command -Parameter Module # Get help for a specific parameter on a specific command
@sssbohdan
sssbohdan / AudioRecorder.swift
Created January 3, 2019 18:24
Audio recorder with simple interface, Swift 4
import Foundation
import AVFoundation
protocol AudioRecorder {
func checkPermission(completion: ((Bool) -> Void)?)
/// if url is nil audio will be stored to default url
func record(to url: URL?)
func stopRecording()
@Tom-Millard
Tom-Millard / lazy-fonts.js
Created February 1, 2018 17:47
Lazy load google fonts
(function(d){
var x = d.createElement("link");
var y = d.getElementsByTagName("script")[0];
x.rel = "stylesheet";
x.href = "https://fonts.googleapis.com/css?family=Raleway:400,900";
y.parentNode.insertBefore(x, y);
})(document);
@virolea
virolea / upload.js
Last active July 9, 2024 02:29
Tracking file upload progress using axios
upload(files) {
const config = {
onUploadProgress: function(progressEvent) {
var percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total)
console.log(percentCompleted)
}
}
let data = new FormData()
data.append('file', files[0])
@obonyojimmy
obonyojimmy / keyboardcapture.go
Last active February 21, 2024 10:13
go lang keyboard capture
package main
import (
"fmt"
"syscall"
//~ "time"
"unsafe"
"golang.org/x/sys/windows"
)
@chrissimpkins
chrissimpkins / gist:5bf5686bae86b8129bee
Last active June 19, 2024 18:05
Atom Editor Cheat Sheet: macOS

Use these rapid keyboard shortcuts to control the GitHub Atom text editor on macOS.

Key to the Keys

  • ⌘ : Command key
  • ⌃ : Control key
  • ⌫ : Delete key
  • ← : Left arrow key
  • → : Right arrow key
  • ↑ : Up arrow key
@karlseguin
karlseguin / init.coffee
Created February 13, 2015 03:54
Atom editor multiple wrap guides
# place this in your init.coffee
atom.workspace.observeTextEditors (e) ->
editor = atom.views.getView(e)
clone = editor.querySelector('.wrap-guide').cloneNode()
clone.style.left = (editor.getDefaultCharacterWidth() * 120) + "px"
editor.querySelector('.underlayer').appendChild(clone)
@mlanett
mlanett / rails http status codes
Last active July 22, 2024 09:14
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@granoeste
granoeste / webkitmediasource-is-type-supported.html
Last active December 26, 2021 10:54
[JavaScript][HTML5][MediaSource] MediaSource.isTypeSupported
<!DOCTYPE html>
<html>
<head>
<script>
window.MediaSource = window.MediaSource || window.WebKitMediaSource;
function testTypes(types) {
for (var i = 0; i < types.length; ++i)
console.log("MediaSource.isTypeSupported(" + types[i] + ") : " + MediaSource.isTypeSupported(types[i]));
}
@cerebrl
cerebrl / 1-securing-express.md
Last active August 2, 2023 22:48
Securing ExpressJS

tl;dr

  1. Don't run as root.
  2. For sessions, set httpOnly (and secure to true if running over SSL) when setting cookies.
  3. Use the Helmet for secure headers: https://github.com/evilpacket/helmet
  4. Enable csrf for preventing Cross-Site Request Forgery: http://expressjs.com/api.html#csrf
  5. Don't use the deprecated bodyParser() and only use multipart explicitly. To avoid multiparts vulnerability to 'temp file' bloat, use the defer property and pipe() the multipart upload stream to the intended destination.