Skip to content

Instantly share code, notes, and snippets.

View ridhwaans's full-sized avatar
🎯
Focusing

ridhwaans ridhwaans

🎯
Focusing
View GitHub Profile
@0xabad1dea
0xabad1dea / copilot-risk-assessment.md
Last active September 11, 2023 10:21
Risk Assessment of GitHub Copilot

Risk Assessment of GitHub Copilot

0xabad1dea, July 2021

this is a rough draft and may be updated with more examples

GitHub was kind enough to grant me swift access to the Copilot test phase despite me @'ing them several hundred times about ICE. I would like to examine it not in terms of productivity, but security. How risky is it to allow an AI to write some or all of your code?

Ultimately, a human being must take responsibility for every line of code that is committed. AI should not be used for "responsibility washing." However, Copilot is a tool, and workers need their tools to be reliable. A carpenter doesn't have to

@csandman
csandman / debounce-swr.js
Last active November 17, 2023 09:12
Debounce useSwr
// originally from: https://github.com/vercel/swr/issues/110#issuecomment-552637429
import useSWR from 'swr';
import useDebounce from 'hooks/use-debounce';
const App = () => {
const [search, setSearch] = useState('');
const debouncedSearch = useDebounce(search, 1000);
const { data: res, isValidating } = useSWR(
() => debouncedSearch ? `/api/suggestion?value=${debouncedSearch}` : null,
Api.fetcher,
@mightyhorst
mightyhorst / netflix-fonts.css
Last active December 31, 2023 06:37
Fonts CDN
@font-face {
font-family: 'Netflix Sans';
font-weight: 100;
font-display: optional;
src: url(https://assets.nflxext.com/ffe/siteui/fonts/netflix-sans/v3/NetflixSans_W_Th.woff2) format('woff2'),url(https://assets.nflxext.com/ffe/siteui/fonts/netflix-sans/v3/NetflixSans_W_Th.woff) format('woff')
}
@font-face {
font-family: 'Netflix Sans';
@beamop
beamop / winstall.ps1
Created May 25, 2020 21:01
My winget powershell script to download my apps using winget (Windows Package Manager for Windows 10)
winget install --id=Google.Chrome -e ; winget install --id=Mozilla.Firefox -e ; winget install --id=Discord.Discord -e ; winget install --id=WhatsApp.WhatsApp -e ; winget install --id=OpenJS.Nodejs -e ; winget install --id=Microsoft.WindowsTerminal -e ; winget install --id=Amazon.AWSCLI -e ; winget install --id=CPUID.CPU-Z -e ; winget install --id=Cryptomator.Cryptomator -e ; winget install --id=hiyohiyo.CrystalDiskInfo -e ; winget install --id=Git.Git -e ; winget install --id=plex.plexmediaplayer -e ; winget install --id=Microsoft.PowerToys -e ; winget install --id=SlackTechnologies.Slack -e ; winget install --id=Microsoft.Skype -e ; winget install --id=Valve.Steam -e ; winget install --id=Spotify.Spotify -e ; winget install --id=Microsoft.Teams -e ; winget install --id=Ubisoft.Uplay -e ; winget install --id=Microsoft.VisualStudioCode -e ; winget install --id=RARLab.WinRAR -e ; winget install --id=WiresharkFoundation.Wireshark -e
@ridhwaans
ridhwaans / terminal-notes
Last active April 13, 2023 18:36
terminal-notes
# cheat_sheet.org.sh
# The contents of this file are released under the GNU General Public License. Feel free to reuse the contents of this work, as long as the resultant works give proper attribution and are made publicly available under the GNU General Public License.
# Best viewed in emacs org-mode.
# Alternately, one can keep this cheat sheet handy by adding the following line to ~/.bashrc:
#
# alias cheatsheet="less ~/path_to_cheat_sheet.org.sh"
* Reference:
** Basics:
@pbojinov
pbojinov / summary.md
Last active August 20, 2022 19:42
useReducer vs useState vs useContext – https://www.robinwieruch.de/react-usereducer-vs-usestate/

Summary

Use useState:

  1. if you manage JavaScript primitives as state
  2. if you have simple state transitions
  3. if you want to have business logic within your component
  4. if you have different properties that don’t change in any correlated manner and can be managed by multiple useState hooks
  5. if your state is co-located to your component
  6. if you’ve got a small application (but the lines are blurry here)
@mjackson
mjackson / useStorage.js
Last active November 4, 2021 06:36
A React hook for persisting state between page refreshes (also SSR compatible)
import { useEffect, useRef } from 'react';
function getItem(storage, key) {
const value = storage.getItem(key);
if (!value) return null;
try {
return JSON.parse(value);
} catch (error) {
@amiralles
amiralles / stack.rb
Created November 5, 2018 13:05
Stack implemented in Ruby.
class Stack
class Node
attr_accessor :next, :data
def initialize data
self.data = data
self.next = nil
end
end
attr_accessor :head, :tail, :length
@denisgolius
denisgolius / generate-ssh-key.sh
Created October 4, 2018 06:55 — forked from grenade/01-generate-ed25519-ssh-key.sh
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/mozilla_rsa
@YumaInaura
YumaInaura / README.md
Last active November 21, 2023 05:48
Gist — Manage in one repository many gists by using git submodule

Gist — Manage in one repository many gists by using git submodule

Gist is a nice service. We can write code so easily and manage files as repository.

But bad points are …

  • Many repository
  • Gist destributes random hash to perticular gists (repositories).
  • So difficult to find or remember contents as repository.