Skip to content

Instantly share code, notes, and snippets.

View StephaneTy-Pro's full-sized avatar

StephaneTy-Pro

  • France - Northern France - Lille/Tourcoing
View GitHub Profile
@StephaneTy-Pro
StephaneTy-Pro / [javascript] bookmarklet - the missing way to search only your own gists, including sorting by stars or forks.md
Created October 24, 2022 11:07
[javascript] bookmarklet - the missing way to search only your own gists, including sorting by stars or forks

TL;DR

  • base URL is: https://gist.github.com/search
  • use q=user:your_username+your_search_term
  • include s=stars and o=desc to sort by "most stars" (most stars on top, least stars at the end).
  • include s=stars and o=asc to sort by "least stars" (least stars on top, most stars at the end).
  • same goes for s=forks .
  • same goes for s=updated .
  • if you do not include s=, it will sort by "best match" .

2022-10-22_195313

@StephaneTy-Pro
StephaneTy-Pro / fileExists.go
Created April 27, 2016 07:50
Snippets for fileExists in Go
func fileExists(filename string) bool {
_, err := os.Stat(filename)
return err == nil
}
@StephaneTy-Pro
StephaneTy-Pro / FindLastLaunchedPID.cmd
Created March 31, 2016 11:36
Batch To See Which PID was launched
@echo off
set PROCESSNAME=notepad2.exe
::First save current pids with the wanted process name
setlocal EnableExtensions EnableDelayedExpansion
set "RETPIDS="
set "OLDPIDS=p"
for /f "TOKENS=1" %%a in ('wmic PROCESS where "Name='%PROCESSNAME%'" get ProcessId ^| findstr [0-9]') do (set "OLDPIDS=!OLDPIDS!%%ap")
SET OLDPIDS
@StephaneTy-Pro
StephaneTy-Pro / default.css
Created February 4, 2016 09:16
treat external link with style
/*Identifier visuellement quand on change de site
le snippets suivant permet d'identifier les liens différemment visuellement
src : https://davidwalsh.name/external-links-css
*/
/* long version */
a[href^="http://"]:not([href*="mysite.com"]),
a[href^="https://"]:not([href*="mysite.com"]),
a[href^="//"]:not([href*="mysite.com"]), {
}
@StephaneTy-Pro
StephaneTy-Pro / is_SubstringContainedInString.cmd
Last active December 6, 2022 08:40
CMD: Check if a substring is in a string
:: cherche si la chaine compiled est présente dans le nom de fichier
ECHO "truc-compiled" | findstr /r /c:"compiled" > nul && SET ISFOUND=1 || SET ISFOUND=0
:: Orgigin
:: http://stackoverflow.com/questions/8756804/check-a-string-for-a-substring-in-a-batch-file-windows
:: Author dbenham
:: This regular expression example will search $1 for "BEGIN" at start of string,
:: "MID" anywhere in middle, and "END" at end. The search is case sensitive by default.
set "search=^BEGIN.*MID.*END$"
// by using KingPin
sSep = app.Flag("separator", "Separator to use in csv file (in read and write) [default is ','].").Short('s').Default(",").String()
// Need to cast *sSep in rune for option Comma in "encoding/csv"
w.Comma = bytes.Runes([]byte(*sSep))[0] // fr => converti la chaine en tableau de bytes, pour apres la convertir en rune
@StephaneTy-Pro
StephaneTy-Pro / SQL:Trouver doublons
Last active January 4, 2016 14:52
SQL doublons
http://sql.sh/55-requete-trouver-doublon
Doublons absolus
SELECT COUNT(*) AS nbr_doublon, champ1, champ2, champ3
FROM table
GROUP BY champ1, champ2, champ3
HAVING COUNT(*) > 1
Doublons sur colonne email par exemple
SELECT COUNT(email) AS nbr_doublon, email
@StephaneTy-Pro
StephaneTy-Pro / excel-convert_column_number_to_letter.txt
Created August 21, 2015 09:57
Excel : Convert Column Number to Letter
http://www.mrexcel.com/forum/excel-questions/71978-convert-column-number-letter.html
SUBSTITUE(ADRESSE(1;COLONNE();4);"1";"")
@StephaneTy-Pro
StephaneTy-Pro / boxstarter-robotf-script
Created July 13, 2015 13:21
boxstarter robotframework
Set-ExplorerOptions -showHidenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
Set-StartScreenOptions -EnableBootToDesktop -EnableDesktopBackgroundOnStart -EnableShowStartOnActiveScreen -EnableShowAppsViewOnStartScreen -EnableSearchEverywhereInAppsView -EnableListDesktopAppsFirst
Install-WindowsUpdate -acceptEula
cinst Python
Install-WindowsUpdate -acceptEula
@StephaneTy-Pro
StephaneTy-Pro / gist:ce786418ba5ac37c82cb
Last active March 29, 2016 12:01
commandes dos utiles
eventvwr REM windows event viewer
tasklist /fi "imagename eq cntlm.exe" REM parmi les tâches trouver la tach cntlm.exe
netstat -a-n-o | find "3128" REM trouver tout ce qui ecoute sur le port 3128
REM les deux commandes ci dessous sont executée en boite DOS d'ou le non doublement du % devant P (%%P dans un .bat)
REM trouver tous les processus qui ecoute sur le port 80 et renvoyer leur nom dans le gestionnaire des tâches
FOR /F "tokens=5 delims= " %P IN ('netstat -a -n -o ^| findstr :80') DO tasklist /fi "pid eq %P"
REM Mettre TaskKill.exe /PID %P permettrait de tuer la tâche
REM to get the PID plus a list of all services hosted by the process of PID 4
tasklist /svc /fi "PID eq 4" /fo list